import { create } from 'zustand'
import { persist } from 'zustand/middleware'

interface UserState {
  username: string
  setUserName: (username: string) => void
}

export const useUserStore = create<UserState>()(
  persist(
    (set) => ({
      username: '',
      setUserName: (username) => set(() => ({ username: username })),
    }),
    {
      name: 'user-storage',
    }
  )
)
